package com.dhcc.DRGsHosp.web.controller;

import org.openkoala.koala.commons.InvokeResult;
import org.openkoala.security.shiro.CurrentUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dhcc.DRGsHosp.facade.SpecialMonitorFacade;
import com.dhcc.DRGsHosp.facade.dto.IndexCalDTO;
import com.dhcc.DRGsHosp.facade.dto.SizerConditionDTO;

/**
 * @title		:SpecialMonitorController.java
 * @description	:专科建设指标监测
 * @author		:lileizheng
 * @date		:2016年3月4日
 * @version     :1.0
 * @copyright   :DHCC 2013-2014 
 */
@Controller("drgsHospWebController40")
@RequestMapping("/specialMonitor")
public class SpecialMonitorController {

	@Autowired
	private SpecialMonitorFacade specialMonitorFacade;
	
	@ResponseBody
	@RequestMapping("/getSpecTotalScore")
	public InvokeResult getSpecTotalScore(IndexCalDTO dto){
		return specialMonitorFacade.getSpecTotalScore(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getCMITotalWeightRatio")
	public InvokeResult getCMITotalWeightRatio(IndexCalDTO dto){
		return specialMonitorFacade.getCMITotalWeightRatio(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getAnalysisQuotas")
	public InvokeResult getAnalysisQuotas(IndexCalDTO dto){
		return specialMonitorFacade.getAnalysisQuotas(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getAnalysisQuotasAndJizhunzhi")
	public InvokeResult getAnalysisQuotasAndJizhunzhi(IndexCalDTO dto){
		return specialMonitorFacade.getAnalysisQuotasAndJizhunzhi(dto);
	}
	
	/**
	 *  建设水平数据
	 *  getGukeData.  
	 *  @Description：
	 *  @Author ChenHanlin
	 *  @param dto
	 *  @return 
	 *  @Date:2018年1月25日下午2:04:05
	 */
	@ResponseBody
	@RequestMapping("/getGukeData")
	public InvokeResult getGukeData(IndexCalDTO dto){
		return specialMonitorFacade.getGukeData(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getSpecialData")
	public InvokeResult getSpecialData(IndexCalDTO dto){
		return specialMonitorFacade.getSpecialData(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getWeightInter")
	public InvokeResult getWeightInter(IndexCalDTO dto){
		return specialMonitorFacade.getWeightInter(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getWeightInterDeps")
	public InvokeResult getWeightInterDeps(IndexCalDTO dto, String weightInter){
		return specialMonitorFacade.getWeightInterDeps(dto, weightInter);
	}
	
	@ResponseBody
	@RequestMapping("/getDepsQuotas")
	public InvokeResult getDepsQuotas(IndexCalDTO dto){
		return specialMonitorFacade.getDepsQuotas(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getDRGsQuotas")
	public InvokeResult getDRGsQuotas(IndexCalDTO dto, String weightInter){
		return specialMonitorFacade.getDRGsQuotas(dto, weightInter);
	}
	
	@ResponseBody
	@RequestMapping("/getDepsDRGs")
	public InvokeResult getDepsDRGs(IndexCalDTO dto){
		return specialMonitorFacade.getDepsDRGs(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getNotInDRGs")
	public InvokeResult getNotInDRGs(IndexCalDTO dto){
		return specialMonitorFacade.getNotInDRGs(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getSpecialTrendData")
	public InvokeResult getSpecialTrendData(IndexCalDTO dto){
		return specialMonitorFacade.getSpecialTrendData(dto);
	}
	
	@ResponseBody
	@RequestMapping("/getTimeFeeLowDRGs")
	public InvokeResult getTimeFeeLowDRGs(IndexCalDTO dto){
		return specialMonitorFacade.getTimeFeeLowDRGs(dto);
	}
	/**
	 *  获取病例区间分布数据
	 *  loadDrgsDistributeData.  
	 *  @Description：
	 *  @Author ChenHanlin
	 *  @param dto
	 *  @param intervalParam
	 *  @return 
	 *  @Date:2017年12月11日上午8:47:35
	 */
	@ResponseBody
	@RequestMapping("/loadCaseDistributeData")
	public InvokeResult loadCaseDistributeData(IndexCalDTO dto,String[] intervalParam){
		return specialMonitorFacade.loadCaseDistributeData(dto,intervalParam);
	}
	/**
	 *  获取病组区间分布数据
	 *  loadDrgsDistributeData.  
	 *  @Description：
	 *  @Author ChenHanlin
	 *  @param dto
	 *  @param intervalParam
	 *  @return 
	 *  @Date:2017年12月11日上午8:47:35
	 */
	@ResponseBody
	@RequestMapping("/loadDrgsDistributeData")
	public InvokeResult loadDrgsDistributeData(IndexCalDTO dto,String[] intervalParam){
		return InvokeResult.success(specialMonitorFacade.loadDrgsDistributeData(dto,intervalParam)) ;
	}
	/**
	 *  根据模块和用户编码查询筛选条件
	 *  findConditionByMoudkeCode.  
	 *  @Description：
	 *  @Author ChenHanlin
	 *  @param moudkeCode
	 *  @return 
	 *  @Date:2017年12月11日上午8:46:59
	 */
	@ResponseBody
	@RequestMapping("/findConditionByMoudkeCode")
	public InvokeResult findConditionByMoudkeCode(String moudkeCode){
		moudkeCode = moudkeCode+"&"+CurrentUser.getUserAccount() ;
		return specialMonitorFacade.findConditionByMoudkeCode(moudkeCode);
	}
	
	/***
	 *  保存区间设置参数
	 *  saveIntervalParam.  
	 *  @Description：
	 *  @Author ChenHanlin
	 *  @param param
	 *  @return 
	 *  @Date:2017年12月11日上午8:46:39
	 */
	@ResponseBody
	@RequestMapping(value="/saveIntervalParam", method = RequestMethod.POST)
	public InvokeResult saveIntervalParam(@RequestParam String param){
	    String moudkeCode = "spec&"+CurrentUser.getUserAccount();
		SizerConditionDTO sc = new SizerConditionDTO(moudkeCode, param, CurrentUser.getRoleName(), CurrentUser.getUserAccount()) ;
		return specialMonitorFacade.saveIntervalParam(sc);
	}

	
	@ResponseBody
	@RequestMapping("/findWeightsExtremum")
	public InvokeResult findWeightsExtremum(IndexCalDTO dto){
		return specialMonitorFacade.findWeightsExtremum(dto);
	}
}
